// const Core = require('@alicloud/pop-core');
const config = require('../config/config');

// const client = new Core({
//   accessKeyId: config.sms.accessKeyId,
//   accessKeySecret: config.sms.accessKeySecret,
//   endpoint: 'https://dysmsapi.aliyuncs.com',
//   apiVersion: '2017-05-25'
// });

module.exports = {
  sendVerificationCode: async (phone, code) => {
    const params = {
      PhoneNumbers: phone,
      SignName: config.sms.signName,
      TemplateCode: config.sms.templateCode,
      TemplateParam: JSON.stringify({ code })
    };

    try {
      //await client.request('SendSms', params, { method: 'POST' });
      return true;
    } catch (err) {
      console.error('短信发送失败:', err);
      return false;
    }
  }
};